<?php

/**
 * 类的接口
 */



interface InterFaceCache
{
    public function set($name, $value);

    public function get($name);
}

class Mysql implements InterFaceCache
{

    public function set($name, $value)
    {
        // TODO: Implement set() method.
    }

    public function get($name)
    {
        // TODO: Implement get() method.
    }
}

class Redis implements InterFaceCache
{

    public function set($name, $value)
    {
        // TODO: Implement set() method.
    }

    public function get($name)
    {
        // TODO: Implement get() method.
    }
}

class Cache
{

    public static function instance($drive)
    {
        switch (strtolower($drive)) {
            case 'mysql';
                return new Mysql();
            case 'redis':
                return new Redis();
        }
    }

}

$instance = Cache::instance('mysql');
$instance->get('name');